/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package src.util;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;

/**
 *
 * @author jasuke
 */
public class Constanta {
    
    private static ResourceBundle 
            bundle = ResourceBundle.getBundle("resources.Bundle", 
                        FacesContext.getCurrentInstance().getViewRoot().getLocale());
    
    public static final BigDecimal MAX_INTEREST_TAXED   = BigDecimal.valueOf(240000);
    public static final String AUTO_NUMBERING   = "[AUTO]";
    
    //saving closing
    public static final String SAV_CLOSED_BY_SYSTEM   = "S";
    public static final String SAV_CLOSED_BY_CUSTOMER   = "C";
    
    
    //interest method
    public static final String INTMETHOD_NONE   = "N";
    public static final String INTMETHOD_LOW    = "L";
    public static final String INTMETHOD_DAILY  = "D";
    public static final String INTMETHOD_AVG    = "A";
                
    //interest method
    public static final String JOINT_TYPE_AND   = "A";
    public static final String JOINT_TYPE_OR    = "O";
    
    //interest type 
    public static final String INTTYPE_EFFECTIVE = "E";
    public static final String INTTYPE_FLAT      = "F";
    
    
    //loan status
    public static final Short LOANSTATUS_WORKSHEET    = 1;
    public static final Short LOANSTATUS_APPROVED = 2;
    public static final Short LOANSTATUS_RUNNING  = 3;
    public static final Short LOANSTATUS_NORMAL_CLOSED    = 4;
    public static final Short LOANSTATUS_CLOSEDBY_CUSTOMER    = 5;
    public static final Short LOANSTATUS_CLOSEDBY_COMPANY = 6;
    
    
    //saving status
    public static final Short SAVSTATUS_WORKSHEET    = 1;
    public static final Short SAVSTATUS_APPROVED = 2;
    public static final Short SAVSTATUS_RUNNING  = 3; //SUDAH DICAIRKAN
    
    
    public static final Short ACC_TYPE_HARTA = 1;
    public static final Short ACC_TYPE_KEWAJIBAN = 2;
    public static final Short ACC_TYPE_MODAL = 3;
    public static final Short ACC_TYPE_PENDAPATAN = 4;
    public static final Short ACC_TYPE_BIAYA = 5;
        
        
    //jurnal-SAVING
    public static final String JV_SDP = "SDP";  // Setoran Simpanan
    public static final String JV_SWD = "SWD";  // Penarikan Simpanan
    public static final String JV_SIC = "SIC";  // Bunga Simpanan  (Jurnal Biaya Bunga - Hutang Bunga  per hari)
    public static final String JV_SIP = "SIP";  // Pencairan Bunga Simpanan  (Hutang Bunga - Tabungan  per bulan)
    public static final String JV_SAD = "SAD";  // Biaya Adm
	
    //jurnal-DEPOSITE
    public static final String JV_DDP = "DDP";  // Penempatan Deposito
    public static final String JV_DIC = "DIC";  // Perhitungan Bunga Deposito Harian
    public static final String JV_DIP = "DIP";  // Pencairan Bunga Deposito
    public static final String JV_DCL = "DCL";  // Penutupan Deposito
    
    //jurnal-LOAN
    public static final String JV_LOP = "LOP";  // Pencairan Kredit
    public static final String JV_LIC = "LIC";  // Perhitungan Bunga Kredit Harian
    public static final String JV_LIP = "LIP";  // Angsuran Kredit
    public static final String JV_LCL = "LCL";  // Pentutupan Kredit

    public static final String JV_BV = "BV";    // Nota Kas/Bank
    public static final String JV_JU = "JU";    // JURNAL UMUM
        
    
    //deposito
    public static final String DEP_DAILY = "D";
    public static final String DEP_MONTH = "M";
    
    public static final Short DISB_INT_TOACCNT  = 1;
    public static final Short DISB_INT_TOBANK   = 2;
    public static final Short DISB_INT_TOCAHS   = 3;
            
    public static final Short BIL_ACTIVE        = 1;
    public static final Short BIL_CLOSED        = 2;
    public static final Short BIL_ROLL_OVERED   = 3;
    public static final Short BIL_CLOSED_BY_CUST= 4;
        

//SAV_GL_DEPOSIT = SETORAN TUNAI
//SAV_GL_DROPDOWN = PENGAMBILAN TUNAI
    //savGlDeposit = SETORAN TUNAI
//savGlDropdown= PENGAMBILAN TUNAI

	
    public static final String SAV_GL_DEPOSIT = "SETORAN TUNAI";
    public static final String SAV_GL_DROPDOWN = "PENGAMBILAN TUNAI";
    
    //policy
    public static final String POLICY_INSERT = "INS;";
    public static final String POLICY_OPEN = "OPN;";
    public static final String POLICY_UPDATE = "UPD;";
    public static final String POLICY_DELETE = "DEL;";
    public static final String POLICY_PRINT = "PRN;";
    public static final String POLICY_APPROVAL = "APP;";
    
    //customer
    public static final String CUSTOMER_PERSONAL = "P";
    public static final String CUSTOMER_CORPORATE = "C";
    
    public static final Short CUSTTYPE_ANGGOTA = 1;
    public static final Short CUSTTYPE_ANGGOTA_LB = 2;
       
        
    //FINANCE ROW STATEMENT
    public static final String FSTMT_HEADER         = "H";
    public static final String FSTMT_DETAIL         = "D";
    public static final String FSTMT_DETAIL_REVENUE = "L";
    public static final String FSTMT_TOTAL          = "T";
    public static final String FSTMT_TOTAL_REVENUE  = "R";
    public static final String FSTMT_SPARATOR       = "S";
    
    //FINANCE ROW STATEMENT
    public static final String FSTMT_FORMAT_NET_CHANGE_SIMPLE           = "NCSP";
    public static final String FSTMT_FORMAT_NET_CHANGE_COMPARE_MONTH    = "NCCM";
    public static final String FSTMT_FORMAT_NET_CHANGE_COMPARE_YEAR     = "NCCY";
    public static final String FSTMT_FORMAT_NET_CHANGE_COMPARE_BUDGET   = "NCCB";

    public static final String FSTMT_FORMAT_BALANCE_SIMPLE              = "BLSP";
    public static final String FSTMT_FORMAT_BALANCE_COMPARE_YEAR        = "BLCY";
    public static final String FSTMT_FORMAT_BALANCE_COMPARE_BUDGET      = "BLCB";
    
    
    
    //JUMLAH HARI DLM 1 THN
    public static final int DAYS_OF_AYEAR  = 365;
    
    //TEXT ALIGNMENT
    public static final int taLeftJustify  = 0;
    public static final int taRightJustify = 1;
    public static final int taCenter       = 2;

    
    public Constanta() {
    }
    
    public static String getSavtrxGlText(String id) {
        String hasil = null;
        switch (id) {
            case SAV_GL_DEPOSIT: hasil = bundle.getString("savGlDeposit"); break;
            case SAV_GL_DROPDOWN: hasil = bundle.getString("savGlDropdown"); break;
        }
        return hasil;
    }
    
    public static String getInterestMethodText(String id) {
        String hasil = null;
        switch (id) {
            case INTMETHOD_NONE: hasil = bundle.getString("interestMethodNone"); break;
            case INTMETHOD_LOW: hasil = bundle.getString("interestMethodLow"); break;
            case INTMETHOD_DAILY: hasil = bundle.getString("interestMethodDaily"); break;
            case INTMETHOD_AVG: hasil = bundle.getString("interestMethodAverage"); break;
        }
        return hasil;
    }
    
    public static String getJointTypeText(String id) {
        String hasil = null;
        switch (id) {
            case JOINT_TYPE_AND: hasil = bundle.getString("joinTypeAnd"); break;
            case JOINT_TYPE_OR: hasil = bundle.getString("joinTypeOr"); break;
        }
        return hasil;
    }
    
    public static String getInterestTypeText(String id) {
        String hasil = null;
        switch (id) {
            case INTTYPE_EFFECTIVE: hasil = bundle.getString("interestTypeEffective"); break;
            case INTTYPE_FLAT: hasil = bundle.getString("interestTypeFlat"); break;
        }
        return hasil;
    }
    
    public static String getLoanStatusText(Short id) {
        String hasil = null;
        
        if (id==LOANSTATUS_WORKSHEET)               hasil = bundle.getString("loanstatusWorksheet"); 
        else if (id==LOANSTATUS_APPROVED)           hasil = bundle.getString("loanstatusApproved"); 
        else if (id==LOANSTATUS_RUNNING)            hasil = bundle.getString("loanstatusRunning"); 
        else if (id==LOANSTATUS_NORMAL_CLOSED)      hasil = bundle.getString("loanstatusNormalClosed"); 
        else if (id==LOANSTATUS_CLOSEDBY_CUSTOMER)  hasil = bundle.getString("loanstatusClosedbyCustomer"); 
        else if (id==LOANSTATUS_CLOSEDBY_COMPANY)   hasil = bundle.getString("loanstatusClosedbyCompany"); 
        
        return hasil;
    }
    
    public static String getAccTypeText(Short id) {
        String hasil = null;
        
        if (id==ACC_TYPE_HARTA)             hasil = bundle.getString("accTypeHarta"); 
        else if (id==ACC_TYPE_KEWAJIBAN)    hasil = bundle.getString("accTypeKewajiban"); 
        else if (id==ACC_TYPE_MODAL)        hasil = bundle.getString("accTypeModal"); 
        else if (id==ACC_TYPE_PENDAPATAN)   hasil = bundle.getString("accTypePendapatan"); 
        else if (id==ACC_TYPE_BIAYA)        hasil = bundle.getString("accTypeBiaya"); 
        return hasil;
    }
        
    
    public static String getJVTypeText(String id) {
        String hasil = null;
        
        switch (id) {
            case JV_SDP: hasil = bundle.getString("jvTextSDP"); break;
            case JV_SWD: hasil = bundle.getString("jvTextSWD"); break;
            case JV_SIC: hasil = bundle.getString("jvTextSIC"); break;
            case JV_SIP: hasil = bundle.getString("jvTextSIP"); break;
            case JV_SAD: hasil = bundle.getString("jvTextSAD"); break;
            case JV_DDP: hasil = bundle.getString("jvTextDDP"); break;
            case JV_DIC: hasil = bundle.getString("jvTextDIC"); break;
            case JV_DIP: hasil = bundle.getString("jvTextDIP"); break;
            case JV_DCL: hasil = bundle.getString("jvTextDCL"); break;
            case JV_LOP: hasil = bundle.getString("jvTextLOP"); break;
            case JV_LIC: hasil = bundle.getString("jvTextLIC"); break;
            case JV_LIP: hasil = bundle.getString("jvTextLIP"); break;
            case JV_LCL: hasil = bundle.getString("jvTextLCL"); break;
            case JV_BV : hasil = bundle.getString("jvTextBV"); break;
            case JV_JU : hasil = bundle.getString("jvTextJU"); break;
        }
        return hasil;
    }
    
        
    public static String getDepPeriodeText(String id) {
        String hasil = null;
        
        switch (id) {
            case DEP_DAILY: hasil = bundle.getString("periodOptDaily"); break;
            case DEP_MONTH: hasil = bundle.getString("periodOptMonthly"); break;
        }
        return hasil;
    }
    
    public static String getDepDisbText(Short id) {
        String hasil = null;
        if (id==DISB_INT_TOACCNT)     hasil = bundle.getString("disbInterestOptToAccnt"); 
        else if (id==DISB_INT_TOBANK) hasil = bundle.getString("disbInterestOptToOtherBank"); 
        else if (id==DISB_INT_TOCAHS) hasil = bundle.getString("disbInterestOptToCash"); 
        return hasil;
    }
    
    public static String getBilyetStatusText(Short id) {
        String hasil = null;
        if (id==BIL_ACTIVE)     hasil = bundle.getString("bilyetStatusActive"); 
        else if (id==BIL_CLOSED) hasil = bundle.getString("bilyetStatusClosed"); 
        else if (id==BIL_ROLL_OVERED) hasil = bundle.getString("bilyetStatusRollOvered"); 
        else if (id==BIL_CLOSED_BY_CUST) hasil = bundle.getString("bilyetStatusByCust"); 
        return hasil;
    }
  
    public static List<SelectItem> getAccountType() {
        List<SelectItem> avblSource = new ArrayList<>();
        avblSource.add(new SelectItem(ACC_TYPE_HARTA, getAccTypeText(ACC_TYPE_HARTA)));
        avblSource.add(new SelectItem(ACC_TYPE_KEWAJIBAN, getAccTypeText(ACC_TYPE_KEWAJIBAN)));
        avblSource.add(new SelectItem(ACC_TYPE_MODAL, getAccTypeText(ACC_TYPE_MODAL)));
        avblSource.add(new SelectItem(ACC_TYPE_PENDAPATAN, getAccTypeText(ACC_TYPE_PENDAPATAN)));
        avblSource.add(new SelectItem(ACC_TYPE_BIAYA, getAccTypeText(ACC_TYPE_BIAYA)));
        return avblSource;
    }
    
    public static List<SelectItem> getDepPeriode() {
        List<SelectItem> avblSource = new ArrayList<>();
        avblSource.add(new SelectItem(DEP_DAILY, getDepPeriodeText(DEP_DAILY)));
        avblSource.add(new SelectItem(DEP_MONTH, getDepPeriodeText(DEP_MONTH)));
        return avblSource;
    }
    
    public static List<SelectItem> getInterestMethod() {
        List<SelectItem> avblSource = new ArrayList<>();
        avblSource.add(new SelectItem(INTMETHOD_NONE, getInterestMethodText(INTMETHOD_NONE)));
        avblSource.add(new SelectItem(INTMETHOD_LOW, getInterestMethodText(INTMETHOD_LOW)));
        avblSource.add(new SelectItem(INTMETHOD_DAILY, getInterestMethodText(INTMETHOD_DAILY)));
        avblSource.add(new SelectItem(INTMETHOD_AVG, getInterestMethodText(INTMETHOD_AVG)));
        return avblSource;
    }
    
    public static List<SelectItem> getJVType() {
        List<SelectItem> avblSource = new ArrayList<>();
        avblSource.add(new SelectItem(JV_SDP, getJVTypeText(JV_SDP)));
        avblSource.add(new SelectItem(JV_SWD, getJVTypeText(JV_SWD)));
        avblSource.add(new SelectItem(JV_SIC, getJVTypeText(JV_SIC)));
        avblSource.add(new SelectItem(JV_SIP, getJVTypeText(JV_SIP)));
        avblSource.add(new SelectItem(JV_SAD, getJVTypeText(JV_SAD)));
        avblSource.add(new SelectItem(JV_DDP, getJVTypeText(JV_DDP)));
        avblSource.add(new SelectItem(JV_DIC, getJVTypeText(JV_DIC)));
        avblSource.add(new SelectItem(JV_DIP, getJVTypeText(JV_DIP)));
        avblSource.add(new SelectItem(JV_DCL, getJVTypeText(JV_DCL)));
        avblSource.add(new SelectItem(JV_LOP, getJVTypeText(JV_LOP)));
        avblSource.add(new SelectItem(JV_LIC, getJVTypeText(JV_LIC)));
        avblSource.add(new SelectItem(JV_LIP, getJVTypeText(JV_LIP)));
        avblSource.add(new SelectItem(JV_LCL, getJVTypeText(JV_LCL)));
        avblSource.add(new SelectItem(JV_BV, getJVTypeText(JV_BV)));
        avblSource.add(new SelectItem(JV_JU, getJVTypeText(JV_JU)));
        return avblSource;
    }
    
    public static List<SelectItem> getDepDisb() {
        List<SelectItem> avblSource = new ArrayList<>();
        avblSource.add(new SelectItem(DISB_INT_TOACCNT, getDepDisbText(DISB_INT_TOACCNT)));
        avblSource.add(new SelectItem(DISB_INT_TOBANK, getDepDisbText(DISB_INT_TOBANK)));
        avblSource.add(new SelectItem(DISB_INT_TOCAHS, getDepDisbText(DISB_INT_TOCAHS)));
        return avblSource;
    }
    
    public static List<SelectItem> getBilyetStatus() {
        List<SelectItem> avblSource = new ArrayList<>();
        avblSource.add(new SelectItem(BIL_ACTIVE, getBilyetStatusText(BIL_ACTIVE)));
        avblSource.add(new SelectItem(BIL_CLOSED, getBilyetStatusText(BIL_CLOSED)));
        avblSource.add(new SelectItem(BIL_ROLL_OVERED, getBilyetStatusText(BIL_ROLL_OVERED)));
        avblSource.add(new SelectItem(BIL_CLOSED_BY_CUST, getBilyetStatusText(BIL_CLOSED_BY_CUST)));
        return avblSource;
    }
    
    
    public static List<SelectItem> getSavtrxGl() {
        List<SelectItem> avblSource = new ArrayList<>();
        avblSource.add(new SelectItem(SAV_GL_DEPOSIT, getSavtrxGlText(SAV_GL_DEPOSIT)));
        avblSource.add(new SelectItem(SAV_GL_DROPDOWN, getSavtrxGlText(SAV_GL_DROPDOWN)));
        return avblSource;
    }
    
    public static List<SelectItem> getFstmtType() {
        List<SelectItem> avblSource = new ArrayList<>();
        avblSource.add(new SelectItem(FSTMT_HEADER, "Header"));
        avblSource.add(new SelectItem(FSTMT_DETAIL, "Detail"));
        avblSource.add(new SelectItem(FSTMT_DETAIL_REVENUE, "Detail Revenue"));
        avblSource.add(new SelectItem(FSTMT_TOTAL, "Total"));
      //  avblSource.add(new SelectItem(FSTMT_TOTAL_REVENUE, "TOTAL REVENUE"));
        avblSource.add(new SelectItem(FSTMT_SPARATOR, "Sparator"));
        return avblSource;
    }
    
    public static List<SelectItem> getFstmtFormat() {
        List<SelectItem> avblSource = new ArrayList<>();
        avblSource.add(new SelectItem(FSTMT_FORMAT_NET_CHANGE_SIMPLE, "Net Change : Simple"));
        avblSource.add(new SelectItem(FSTMT_FORMAT_NET_CHANGE_COMPARE_MONTH, "Net Change : Compare Month"));
        avblSource.add(new SelectItem(FSTMT_FORMAT_NET_CHANGE_COMPARE_YEAR, "Net Change : Compare Year"));
   //     avblSource.add(new SelectItem(FSTMT_FORMAT_NET_CHANGE_COMPARE_BUDGET, "Net Change : Compare Budget"));
        avblSource.add(new SelectItem(FSTMT_FORMAT_BALANCE_SIMPLE, "Balance : Simple"));
        avblSource.add(new SelectItem(FSTMT_FORMAT_BALANCE_COMPARE_YEAR, "Balance : Compare Year"));
    //    avblSource.add(new SelectItem(FSTMT_FORMAT_BALANCE_COMPARE_BUDGET, "Balance : Compare Budget"));
        return avblSource;
    }

}
